/**
 */
package org.xtext.example.mydsl.componentBasedSoftwareDevelopment.impl;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.xtext.example.mydsl.componentBasedSoftwareDevelopment.ComponentActionStatement;
import org.xtext.example.mydsl.componentBasedSoftwareDevelopment.ComponentAlternationConstraint;
import org.xtext.example.mydsl.componentBasedSoftwareDevelopment.ComponentBasedSoftwareDevelopmentPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Component Alternation Constraint</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.xtext.example.mydsl.componentBasedSoftwareDevelopment.impl.ComponentAlternationConstraintImpl#getAction1 <em>Action1</em>}</li>
 *   <li>{@link org.xtext.example.mydsl.componentBasedSoftwareDevelopment.impl.ComponentAlternationConstraintImpl#getAction2 <em>Action2</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ComponentAlternationConstraintImpl extends ComponentStatementImpl implements ComponentAlternationConstraint
{
  /**
   * The cached value of the '{@link #getAction1() <em>Action1</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getAction1()
   * @generated
   * @ordered
   */
  protected ComponentActionStatement action1;

  /**
   * The cached value of the '{@link #getAction2() <em>Action2</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getAction2()
   * @generated
   * @ordered
   */
  protected ComponentActionStatement action2;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ComponentAlternationConstraintImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return ComponentBasedSoftwareDevelopmentPackage.Literals.COMPONENT_ALTERNATION_CONSTRAINT;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ComponentActionStatement getAction1()
  {
    return action1;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetAction1(ComponentActionStatement newAction1, NotificationChain msgs)
  {
    ComponentActionStatement oldAction1 = action1;
    action1 = newAction1;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ComponentBasedSoftwareDevelopmentPackage.COMPONENT_ALTERNATION_CONSTRAINT__ACTION1, oldAction1, newAction1);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setAction1(ComponentActionStatement newAction1)
  {
    if (newAction1 != action1)
    {
      NotificationChain msgs = null;
      if (action1 != null)
        msgs = ((InternalEObject)action1).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ComponentBasedSoftwareDevelopmentPackage.COMPONENT_ALTERNATION_CONSTRAINT__ACTION1, null, msgs);
      if (newAction1 != null)
        msgs = ((InternalEObject)newAction1).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ComponentBasedSoftwareDevelopmentPackage.COMPONENT_ALTERNATION_CONSTRAINT__ACTION1, null, msgs);
      msgs = basicSetAction1(newAction1, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ComponentBasedSoftwareDevelopmentPackage.COMPONENT_ALTERNATION_CONSTRAINT__ACTION1, newAction1, newAction1));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ComponentActionStatement getAction2()
  {
    return action2;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetAction2(ComponentActionStatement newAction2, NotificationChain msgs)
  {
    ComponentActionStatement oldAction2 = action2;
    action2 = newAction2;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ComponentBasedSoftwareDevelopmentPackage.COMPONENT_ALTERNATION_CONSTRAINT__ACTION2, oldAction2, newAction2);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setAction2(ComponentActionStatement newAction2)
  {
    if (newAction2 != action2)
    {
      NotificationChain msgs = null;
      if (action2 != null)
        msgs = ((InternalEObject)action2).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ComponentBasedSoftwareDevelopmentPackage.COMPONENT_ALTERNATION_CONSTRAINT__ACTION2, null, msgs);
      if (newAction2 != null)
        msgs = ((InternalEObject)newAction2).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ComponentBasedSoftwareDevelopmentPackage.COMPONENT_ALTERNATION_CONSTRAINT__ACTION2, null, msgs);
      msgs = basicSetAction2(newAction2, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ComponentBasedSoftwareDevelopmentPackage.COMPONENT_ALTERNATION_CONSTRAINT__ACTION2, newAction2, newAction2));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_ALTERNATION_CONSTRAINT__ACTION1:
        return basicSetAction1(null, msgs);
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_ALTERNATION_CONSTRAINT__ACTION2:
        return basicSetAction2(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_ALTERNATION_CONSTRAINT__ACTION1:
        return getAction1();
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_ALTERNATION_CONSTRAINT__ACTION2:
        return getAction2();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_ALTERNATION_CONSTRAINT__ACTION1:
        setAction1((ComponentActionStatement)newValue);
        return;
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_ALTERNATION_CONSTRAINT__ACTION2:
        setAction2((ComponentActionStatement)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_ALTERNATION_CONSTRAINT__ACTION1:
        setAction1((ComponentActionStatement)null);
        return;
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_ALTERNATION_CONSTRAINT__ACTION2:
        setAction2((ComponentActionStatement)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_ALTERNATION_CONSTRAINT__ACTION1:
        return action1 != null;
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_ALTERNATION_CONSTRAINT__ACTION2:
        return action2 != null;
    }
    return super.eIsSet(featureID);
  }

} //ComponentAlternationConstraintImpl
